#ifndef _VIRT_IO_H
#define _VIRT_IO_H

#include <pt_regs.h>

#define ESR_IL_OFFSET              (25)
#define ESR_IL_MASK                (1 << 0)

#define ESR_ISS_DA_SRT_SHIFT         (16)
#define ESR_ISS_DA_SRT_MASK        (0x1f)

#define ESR_ISS_MASK               (0x1FFFFFF)
#define ESR_ISS_DA_ISV_BIT         (1UL << 24)
#define ESR_ISS_DA_FnV_BIT         (1UL << 10)
#define ESR_ISS_DA_SAS_SHIFT         (22)
#define ESR_ISS_DA_SAS_MASK          (0x3)
#define ESR_ISS_DA_WnR_BIT         (1UL << 6)

#define ESR_ISS_DA_SF_BIT          (1UL << 15)

#define ESR_ISS_DA_SSE_BIT         (1UL << 21)

int check_emul_mmio_range(unsigned long far);
int emul_device(struct pt_regs *regs, unsigned long fault_addr,
        unsigned int esr);

struct emu_mmio_access
{
    struct pt_regs *regs;
    unsigned long addr;
    int write;
    int sign_ext;
    int width;
    int reg;
    int reg_width;
};


#endif // !_VIRT_IO_H